#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

#include <serialplot.h>
#include <wave_data.h>
#include <QThread>

#include<QPaintEvent>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    void serialplotBtnOpenClose();
    void serialplotCOMcallback(QStringList);
    void serialplotSendData();
    void serialRecvData(QByteArray data);

    //串口信号
signals:
    void connectSerialSignal(SerialPlot::COMINFO);
    void closeCom(); //关闭串口
    void sendCom(char *data,int len);
    void sendComFile(QString filename,int pageSize,int delay);
private:
    Ui::Widget *ui;


private:
    QThread*   serialplotThread = nullptr;
    QThread*   waveDataThread = nullptr;
    SerialPlot serial;
    wave_data  waveData;

};
#endif // WIDGET_H
